package com.gitee.wsl.ext.any


inline fun <reified T> T.either(
    vararg method: (condition: T) -> Boolean
): T? = if (this != null) {
    if (method.any { it(this) }) {
        this
    } else {
        null
    }
} else {
    null
}

inline fun <reified T> T.eitherNot(
    vararg method: (condition: T) -> Boolean
): T? = if (this != null) {
    if (!method.any { it(this) }) {
        this
    } else {
        null
    }
} else {
    null
}